# 迭代list
arr = list(range(3))
for item in arr: 
    print(item)
print("==========================")
# 迭代dic
m1 = {'a':1,'b':2}
for key in m1 : 
    print(key)
m1 = {'a':1,'b':2}
for value in m1.values() : 
    print(value)
m1 = {'a':1,'b':2}
for key,value in m1.items() : 
    print(key,value)
print("==========================")
# str迭代        
s1 = '唱跳rap'
for s in s1:
    print(s)
# 判断是否可迭代对象
from collections.abc import Iterable
print(isinstance('abc', Iterable) )# str是否可迭代
print("==========================")
# enumerate强制类型转化为key-value形式
for i, value in enumerate(['A', 'B', 'C']):
    print(i,value)
print("==========================")
# 迭代解构
for x,y in [(1,2),(3,4)]:
    print(x,y)
    